package com.kb.controller;

import com.kb.common.ApiResponse;
import com.kb.service.WaitPartNumberService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/waitPartNumber")
@RequiredArgsConstructor
public class WaitPartNumberController {

    private final WaitPartNumberService waitPartNumberService;

    @PostMapping("/sync")
    @ResponseBody
    @XxlJob("syncWaitPartNumber")
    public ApiResponse<Boolean> syncWaitPartNumber() throws InterruptedException {
        return ApiResponse.<Boolean>success(waitPartNumberService.syncWaitPartNumber());
    }
}
